<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Marketing extends Model
{
    protected $table = 'marketing';
    public $timestamps = false;
    protected $fillable = [
        'activity_name',
        'activity_sale_id',
        'type',
        'scope',
        'start_at',
        'scope',
        'scope_title',
        'amount',
        'number',
        'status',
        'updated_at',
    ];

    //状态（1处理中 2已发放）
    const STATUS_ONE = 1;
    const STATUS_TWO = 2;
    //发放类型（1指定用户，2指定会员等级，全部用户）
    const TYPE_ONE = 1;
    const TYPE_TWO = 2;
    const TYPE_THREE = 3;
    const MARKETING_STATUS = [
        self::STATUS_ONE => '处理中',
        self::STATUS_TWO => '已发放',
    ];
    public function activity()
    {
        return $this->hasOne(ActivitySale::class,'id','activity_sale_id');
    }
}
